Introduction to openanalysis

In our daily life, we encounter many algorithms. Knowingly or Unknowingly, algorithms make our life easier. Analysis of algorithms is a special field of interest in Computer Science. Analysis evaluates the algorithm, and leads to invention of faster algorithms. Visualization leads to the better understanding of how algorithms work. The package openanalysis is inteded as a tool for analyzing and visualizing algorithms.

Types of supported algorithms

The following types of algorithms are currently supported. We plan to support more kind of algorithms in the future.

  • Comparison based Sorting Algorithms ( Analysis + Visualization )
  • Comparison based Searching Algorithms ( Analysis )
  • Comparison based Pattern Matching Algorithms ( Analysis )
  • Data Structures and Related algorithms ( Visualization )
  • Graph Algorithms based on Tree Growth technique ( Visualizaiton )
  • Graph Algorithms utilizing Matrix and Dynamic Programming ( Visualization )

Setting up openanalysis

Dependency Binary Packages

openanalysis expects few binary packages to be installed, which are not installed automatically by the installer. In Linux, you can install these packages via your package manager. For Windows, grab the downloads from their websites.

  • graphviz
  • ffmpeg
  • libgraphviz-dev for compiling pygraphviz in Linux
  • pkg-config for compiling pygraphviz in Linux
  • python3-tk as matplotlib backend in Linux
  • Visual C++ 2015 Build Tools for compiling pygraphviz in Windows
  • Python 3.5 or later

Installation

pip install openanalysis  # Or pip3 depending on your configuration

If all things go well, you have a working installation of openanalysis.

Inside the package

openanalysis has following package structure.

openanalysis/
├── base_data_structures.py            - Provides PriorityQueue and UnionFind data  structures
├── datastructures.py                  - Provides classes for Data Structure Visualization
├── matrix_animator.py                 - Provides classes for DP based Graph algorithms
├── searching.py                       - Provides classes for Sorting algorithms
├── sorting.py                         - Provides classes for Searching algorithms
├── string_matching.py                 - Provides classes for String Matching algorithms
└── tree_growth.py                     - Provides classes for Tree growth based Graph Algorithms

importing the modules

Since openanalysis root does not have any classes as is, we will import methods from its modules. In further chapters, we shall see the purpose of every modules and shall use it.

Key factor for analysis

In Computer Science, running time of algorithms is greately considered. Every alorithm solves the given instance of problem by performing some basic operation. The time taken by the algorithm is directly proportional to number of basic operations it has performed.

In normal working environment, time taken by the algorithm to solve a problem is affected by task scheduling performed by OS. We have to fit the obtained running time data in order to analyse the algorithm. Instead of using running time as a key for analysis, we will use number of basic operations as a key in openanalysis.

This change in key factor implies, we have to adhere to a standard for implementing algorithms. In fact, openanalysis provides such standards, either in the form of rules, or in the form of Base Classes. We shall see those rules in upcomming chapter. In future builds, we plan to include Time-based analysis also.